\pard\tx3120\tx3620\tx4120\fs28\li2620 The PSFile class is a simple specilization of the File class. It merely provides several methods for interacting with a file making reference to strings and lines of text, rather than arbitrary chunks of bytes.\
\fs16 \
\fs28 The current version is definitely incomplete, and only has the methods that I've direly needed so far. Most notably, it is really only usefull for
\i writing
\i0 to. There are no specilized reading methods.\
\fs16 \
\fs28 At the moment, this allows one to append another file to the contents of the current one (usefull for importing a set of procedures and other definitions that this file will need), writing DSC comments (%%foo: ...), lines of text, and dumping a string of bytes has hex data. Additionally, it supports two methods that do printf() type of formatting. These are cruder than I'd like, and someday should be made prettier. \
\
\fs16 \
\pard\tx7140\li2100 \
\
\fs28 INSTANCE VARIABLES\
\fs16 \
\pard\tx7140\tx10180\tx10680\i\fs28\fi-4540\li7140 Inherited from Object
\i0 Class isa;\
\fs16 \
\i\fs28 Declared in PSFile
\i0 None\
\pard\tx7140\fs16\li2100 \
\
\
\fs28 METHOD TYPES\
\fs16 \
\pard\tx7140\tx10180\tx10680\fs28\fi-4540\li7140 From other files
\pard\tx3120\tx3620\tx4120\b0\fs28\li2620 Inserts the entire contents of
\i file
\i0 into the current position of the file.\
\fs16 \
\pard\tx7140\b\li2100 \
\fs28 WriteDSCComment:\
\pard\f1\b0\fi-1020\li3620 -
\f0\b WriteDSCComment:
\b0 (CString)
\i comment
\b\i0 \
\fs16 \
\pard\tx3120\tx3620\tx4120\b0\fs28\li2620 Writes the specified string out as a PS DSC comment. Hence, if given `BoundingBox: 45, 67, 87,90', this will write out: `%%Boundingbox: 45, 67, 87, 90'. \
\pard\tx3120\tx3620\tx4120\b0\fs28\li2620 This also writes a DSC comment. however, it uses a printf-like calling syntax. Arguments after the format will be used to generate the finished comment string. This form must be viewed as an intermediate form in two respects: I'm not yet sure whether I should be being passed a buffer or a maximum size of the buffer. Additionally, ideally a later version or different method will do all this without the user passing a buffer. in any case, the buffer passed is used by the routine to build the final formatted string. If it is not long enough, the results are unpredictable. The format string is used, in printf fashion, to dictate the consumption of following arguments, and they are displayed as specified by the printf type syntax in the format string. The formatted string is then written to the file.\
\fs16 \
\pard\tx7140\b\li2100 \
\fs28 WriteComment:\
\pard\f1\b0\fi-1020\li3620 -
\f0\b WriteComment:
\b0 (CString)
\i comment
\b\i0 \
\fs16 \
\pard\tx3120\tx3620\tx4120\b0\fs28\li2620 Writes the specified string out as a PS comment. Hence, if given `We now start the inifinite loop', this will write out: `% We now start the infinite loop'. \
\pard\tx3120\tx3620\tx4120\b0\fs28\li2620 This is identical to WriteFormatttedDSCComment:: ,save that it writes a simple PS comment, and not a DSC one.\
\fs16 \
\pard\tx7140\b\li2100 \
\fs28 WriteText:\
\pard\f1\b0\fi-1020\li3620 -
\f0\b WriteText:
\b0 (CString)
\i text
\b\i0 \
\fs16 \
\pard\tx3120\tx3620\tx4120\b0\fs28\li2620 This writes the specified text out to the destination file litterally. \
\pard\tx3120\tx3620\tx4120\b0\fs28\li2620 This is like WriteFormattedComment, save that it writes out a line of PS code and terminates it with a newline.\
\fs16 \
\pard\tx7140\b\li2100 \
\fs28 ForceNewLine\
\pard\f1\b0\fi-1020\li3620 -
\f0\b ForceNewLine\
\fs16 \
\pard\tx3120\tx3620\tx4120\b0\fs28\li2620 This little kludge merely inserts a LF character into the file.\
\fs16 \
\pard\tx7140\b\li2100 \
\fs28 WriteByteAsHex\
\pard\f1\b0\fi-1020\li3620 -
\f0
\b WriteByteAsHex:
\b0 (Byte)
\b
\b0\i thebyte
\b\i0 \
\fs16 \
\pard\tx3120\tx3620\tx4120\b0\fs28\li2620 Given a byte, this will write it out as a hexadecimal number. Thus, given the byte `A', it writes out `41'.\
\fs16 \
\pard\tx7140\b\li2100 \
\fs28 Write:
\fc0 BytesOfHexDataFrom:
\
\pard\f1\b0\fi-1020\li3620 -
\f0\b Write:
\b0 (PositiveInteger)
\i num
\i0
\b\fc0 BytesOfHexDataFrom:
\b0 (ByteString)
\i buffer
\b\i0 \
\fs16 \
\pard\tx3120\tx3620\tx4120\b0\fs28\li2620 This writes
\i num
\i0 bytes of binary data from
\i buffer
\i0 into the file as ascii hex data. Basically, like a repeated use of WriteByteAsHex:.\
\fs16 \
\pard\tx7140\b\li2100 \
\fs28 Write:Inverted
\fc0 BytesOfHexDataFrom:\
\pard\f1\b0\fi-1020\li3620 -
\f0\b Write:
\b0 (PositiveInteger)
\i num
\i0
\b Inverted
\fc0 BytesOfHexDataFrom:
\b0 (ByteString)
\i buffer
\b\i0 \
\fs16 \
\pard\tx3120\tx3620\tx4120\b0\fs28\li2620 This writes
\i num
\i0 bytes of binary data from
\i buffer
\i0 into the file as ascii hex data. Unlike Write:BytesOfHexDataFrom:, this inverts the hex data (1's become 0's, and vice versa) before it converts it..\
\fs16 \
\pard\tx7140\b\li2100 \
\b0 \
\fs28 BUGS AND PROBLEMS\
\fs16 \
\pard\tx3120\tx3620\tx4120\fs28\li2620 This bugger
\i grew
\i0 . It was not planned. And several parts of it really reflect tihs strongly. A lot could be done to enhance it. If the need arrives, I'd advocate making a 2.0 revision, say, that completely broke everything that came before. For now, however, it works even though I'm not entirely sure the Write:... methods do what I always want them to do... (thinking of endian-ness)\
\fs16 \
\pard\tx7140\li2100 \
\
\fs28 ENHANCEMENT IDEAS\
\fs16 \
\pard\tx3120\tx3620\tx4120\fs28\li2620 DSC comments might take a key and a value argument ('boundingbox' and '45...', and add the colon, space or whatever is required)\